<%@ page language="java" pageEncoding="UTF-8"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html lang="true">
  <head>
    <html:base />
    
    <title>SoftwareInfoList.jsp</title>

	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/resources/css/ext-all.css"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/ext-base.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/ext-all.js"></script>
<script type="text/javascript">
<!--
Ext.onReady(function(){
	var myData =new Array();
	<logic:iterate id="o" indexId="index" name="softwareInfoForm" property="siList">
    	myData[myData.length]=['${o.uniqueCode}','${o.softwareName}','${o.softwareIntroduction}',
    							'${o.softwareSrc}','${o.createDate}'];
    </logic:iterate>	

    // example of custom renderer function
    function change(val){
        if(val > 0){
            return '<span style="color:green;">' + val + '</span>';
        }else if(val < 0){
            return '<span style="color:red;">' + val + '</span>';
        }
        return val;
    }

    // example of custom renderer function
    function pctChange(val){
        if(val > 0){
            return '<span style="color:green;">' + val + '%</span>';
        }else if(val < 0){
            return '<span style="color:red;">' + val + '%</span>';
        }
        return val;
    }

    // create the data store
    var store = new Ext.data.SimpleStore({
        fields: [
           {name: 'uniqueCode'},
           {name: 'softwareName'},
           {name: 'softwareIntroduction'},
           {name: 'softwareSrc'},
           {name: 'createData'}
        ]
    });
    store.loadData(myData);

    // create the Grid
    var grid = new Ext.grid.GridPanel({
        store: store,
        columns: [
            {id:'company',header: "uniqueCode", sortable: true, dataIndex: 'uniqueCode'},
            {header: "softwareName",  sortable: true, dataIndex: 'softwareName'},
            {header: "softwareIntroduction",  sortable: true,  dataIndex: 'softwareIntroduction'},
            {header: "softwareSrc",  sortable: true,  dataIndex: 'softwareSrc'},
            {header: "createData",  sortable: true, dataIndex: 'createData'}
        ],
        stripeRows: true,
        autoExpandColumn: 'company',
        height:350,
        width:600,
        title:'Array Grid'
    });

    grid.render('grid-example');

    grid.getSelectionModel().selectFirstRow();
});
//-->
</script>

  </head>
  
  <body>
     <div id="grid-example"></div>
  </body>
</html:html>
